<template>
    <div class="container">
        <div class="crumb" data-cs-p="面包屑">
            <div class="item"><router-link to="/">菲玩网</router-link><em>&gt;</em></div>
            <div class="item"><router-link to="/tourist">美食</router-link><em>&gt;</em></div>
            <div class="item"><router-link to="/tourist">{{itemData.province_name}}</router-link><em>&gt;</em></div>
            <div class="item"><router-link to="/tourist">{{itemData.city_name}}</router-link></div>
        </div>
        <div class="detail-nav">
            <div>
                <div>
                    <div class="nav-left tf">
                        <a href="#" target="_self" class="on">饭店详情</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="item-image-desc">
            <div class="item-detail-left">
                <div class="image-detail-desc">
                    <img :src="itemImage.cover[0]" width="600" height="400">
                </div>
            </div>
            <div class="item-detail-right">
                <div class="info_left item-info">
                    <div class="title">
                        <h1><strong>{{itemData.cn_name}}</strong></h1>
                        <span style="margin-right:15px;font-size:12px;" :title="itemData.cn_name">{{itemData.en_name}}</span>
                    </div>
                </div>
                <div class="bd"></div>
                <div class="tags item-info">
                    <a class="tag-green" href="javascript:void(0);">交通方便</a>
                    <a class="tag-blue" href="javascript:void(0);">景色优美</a>
                    <a class="tag-orange" href="javascript:void(0);">民风淳朴</a>
                </div>
                <div class="bd"></div>
                <div class="address item-info">
                    <div class="address-left left">
                        <h3>饭店地址：</h3>&nbsp;&nbsp;<span style="color:#333;" :title="itemData.address">{{itemData.address}}</span>
                    </div>
                </div>
                <div class="bd"></div>
                <div class="address item-info">
                    <div class="address-left left">
                        <h3>开放时间：</h3>&nbsp;&nbsp;
                        <span style="color:#ff3333; font-size: 22px;">{{itemData.open_time}}点&nbsp;&nbsp;-&nbsp;&nbsp;{{itemData.close_time}}点</span>
                    </div>
                </div>
                <div class="bd"></div>
                <div class="address item-info">
                    <div class="address-left left">
                        <h3>招牌美食：</h3>&nbsp;&nbsp;
                        <span style="color:#ff3333; font-size: 22px;" v-if="itemData.fee_ticket_has" >{{itemData.fee_ticket_amount}}</span>
                        <span style="color:#ff3333; font-size: 22px;" v-if="!itemData.fee_ticket_has" >免费</span>
                    </div>
                </div>
                <div class="bd"></div>
                <div class="address item-info">
                    <div class="address-left left">
                        <h3>简单介绍：</h3>&nbsp;&nbsp;<span style="color:#333;">{{itemData.summary_cn}}</span>
                    </div>
                </div>
            </div>
        </div>

        <div class="item-map" style="padding-bottom: 155px;">
            <div class="set-left">
                <div class="room-set-title">
                    <span class="room-map">景点地图</span>
                </div>
                <div>
                    <GmapMap
                            :center="{lat: itemData.x, lng :itemData.y}"
                            :zoom="20"
                            map-type-id="roadmap"
                            style="width: 1200px; height: 450px"
                    >
                        <GmapMarker
                                v-for="(m, index) in markers"
                                :key="index"
                                :position="m.position"
                                :clickable="true"
                                :draggable="true"
                                @click="center=m.position"
                        />
                    </GmapMap>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import http from "../util/http";

    export default {
        name: "foodDetail",
        data() {
            return {
                itemData : {
                    cn_name: '',
                    en_name: '',
                    summary_cn: '',
                    fee_ticket_amount: '',
                    fee_ticket_has: '',
                    fee_inner_project_has: '',
                    open_time: '',
                    close_time: '',
                    type_id: '',
                    type_sub_id: '',
                    content_en: '',
                    content_cn: '',
                    city_name: '',
                    province_name: '',
                    address: '',
                    x: 0,
                    y: 0
                },
                markers: [],
                itemImage : {
                    cover: [],
                    list: []
                },
                itemId: 0,
            }
        },
        mounted() {
            this.itemId = this.$route.params.id;
            http.get("food/detail/" + this.itemId).then(res => {
                if (res.success === true) {
                    this.itemData   = res.data.data;
                    this.itemData.x = +this.itemData.x;
                    this.itemData.y = +this.itemData.y;

                    this.itemImage  = res.data.image;
                    this.markers = [{ position: { lat: +this.itemData.x, lng: +this.itemData.y }}]
                }
            });
        },
        methods:{
        }
    }
</script>

<style lang="scss">
    @import './../assets/scss/config.scss';
    @import './../assets/scss/reset.scss';
    @import './../assets/scss/mixin.scss';

    .container {
        .bd {
            border-bottom: 1px solid #F4F4F4;
            clear: both;
            margin-bottom: 10px;
        }
        .crumb {
            height: 20px;
            padding: 15px 0;
            color: #666;
            font-size: 12px;
            line-height: 20px;
            .item {
                float: left;
                em {
                    margin: 0 6px;
                    color: #999;
                    font-family: 'simsun';
                    font-style: normal;
                }
            }
            a {
                color: #666;
                font-size: 12px;
            }
        }
        .detail-nav {
            width: 1200px;
            height: 50px;
            line-height: 50px;
            background: #f3f3f3;
            .nav-left {
                float: left;
                font-size: 15px;
                overflow: hidden;
                width: 100%;
                a {
                    float: left;
                    padding: 0 20px;
                    font-size: 16px;
                    color: #ff9d00;
                    font-weight: bold;
                }
                .on {
                    color: #ff3333 !important;
                    border-bottom: solid 3px #ff9d00;
                    height: 47px;
                }
            }
        }

        .item-image-desc {
            width: 1200px;
            margin: 0 auto;
            position: relative;
            overflow: hidden;
            padding-top: 10px;
            .item-detail-left {
                float: left;
                display: inline;
                position: relative;
                width: 600px;
                height: 400px;
                overflow: hidden;
            }

            .item-detail-right {
                .item-info {
                    line-height: 32px;
                    font-size: 14px;
                    clear: both;
                    float: left;
                    width: 552px;
                    margin: 2px 0;
                }
                h3 {
                    float: left;
                    font-weight: bold;
                    display: inline;
                }

                float: right;
                position: relative;
                .info_left {
                    line-height: 50px;
                    font-size: 14px;
                    clear: both;
                    height: 50px;
                    float: left;
                    width: 552px;
                    .title {
                        font-size: 14px;
                        color: #666;
                        height: 42px;
                        overflow: hidden;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                        h1 {
                            font-size: 30px;
                            color: #333;
                            margin-right: 15px;
                            float: left;
                            display: inline;
                            line-height: 42px;                        }
                    }
                }

                .tags {
                    a {
                        padding: 2px 3px;
                        margin-right: 2px;
                    }
                    .tag-green {
                        border: 1px solid #77be66;
                        color: #77be66;
                    }

                    .tag-orange {
                        border: 1px solid #cc9752;
                        color: #cc9752;
                    }

                    .tag-blue {
                        border: 1px solid #7eb6e2;
                        color: #7eb6e2;
                    }
                }

                .address {
                    h3 {
                        font-size: 14px;
                        color: #333;
                    }
                    .address-right {
                        height: auto;
                        margin-left: 10px;
                        position: relative;
                        a {
                            height: 22px;
                            border: solid 1px #fff;
                            font-size: 12px;
                            line-height: 22px;
                            color: #999;
                            text-decoration: none;
                            padding: 0px 6px 0 4px;
                            margin-top: 5px;
                            overflow: hidden;
                        }
                    }
                }
            }

            .detail-desc-name {
                display: block;
                overflow: hidden;
            }
        }

        .item-map {
            .room-set-title {
                display: block;
                overflow: hidden;
                border-bottom: 2px solid #e3e3e3;
                span {
                    display: block;
                    padding: 0 0 0 30px;
                    line-height: 80px;
                    font-size: 18px;
                    color: #333;
                }
                .room-map {
                    background: url("/images/icon-map.png") no-repeat left center;
                }
            }
        }
    }

</style>

